<?php
class Zhuanti_model extends CI_Model {
	function __construct()
	{
		parent::__construct();
		$this->load->database();
	}
	//专题商品
	function getGoods(){
		$today = date("Y-m-d");
		//专题key
		$this->db->where("startTime <=",$today);
		$this->db->where("endTime >=",$today);
		$query = $this->db->get("zz_extend_zhuanti_key",1);
		$zhuantiKey = $query->row_array();
		//专题内容
		$this->db->where("status",1);
		$this->db->where("isDel",0);
		$this->db->where("zhuantiID",$zhuantiKey['id']);
		$this->db->order_by("sort","ASC");
		$query = $this->db->get("zz_extend_zhuanti");
		$goods = $query->result_array();
		//返回
		return $goods;
	}
	//商品的点击
    function AjaxGoodsClick($id){
    	$this->db->set("clickNum","IFNULL(clickNum+1,1)",false);
    	$this->db->where("id",$id);
    	$this->db->update("zz_extend_zhuanti");
    	return $this->db->affected_rows();
    }
}
?>